fix(pdf): detect system Chromium on Linux for distros without playwright support to fix download issue#636
Open
JsNcAr wants to merge 1 commit intosrbhr:mainfrom
Open
Conversation
…ght support Enable PDF generation on non-Debian systems (OpenSUSE, Fedora, Arch) where Playwright browsers are hard to install. Users can now use system-installed Chrome/Chromium instead. - Add Linux browser path detection (/usr/bin/chromium, google-chrome) - Support Snap and Flatpak installations - Windows behavior unchanged Previously _find_chromium_executable() only checked Windows paths, causing failures when system browsers were available. Tested on OpenSUSE with system Chromium
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="apps/backend/app/pdf.py">
<violation number="1" location="apps/backend/app/pdf.py:87">
P2: macOS fallback detection is missing: the non-Windows branch only checks Linux paths, so macOS systems without Playwright browsers still fail to find system Chrome despite the cross-platform intent.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| / "Microsoft/Edge/Application/msedge.exe", | ||
| ] | ||
| else: | ||
| # Linux/macOS paths |
Contributor
There was a problem hiding this comment.
P2: macOS fallback detection is missing: the non-Windows branch only checks Linux paths, so macOS systems without Playwright browsers still fail to find system Chrome despite the cross-platform intent.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/backend/app/pdf.py, line 87:
<comment>macOS fallback detection is missing: the non-Windows branch only checks Linux paths, so macOS systems without Playwright browsers still fail to find system Chrome despite the cross-platform intent.</comment>
<file context>
@@ -71,18 +71,33 @@ def _resolve_pdf_margins(margins: Optional[dict]) -> dict:
+ / "Microsoft/Edge/Application/msedge.exe",
+ ]
+ else:
+ # Linux/macOS paths
+ candidates = [
+ Path("/usr/bin/google-chrome"),
</file context>
Owner
|
Hey @JsNcAr Thanks for this PR. I have some more questions and there's a few more people who are having the same problem. Can you join our discord please? So that I can loop you into the conversation with all the other community members? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
No existing issue. This PR fixes PDF generation failures on non-Debian Linux distributions.
Description
PDF generation fails on non-Debian systems (OpenSUSE, Fedora, Arch) with "Playwright browser executable is missing" error, even when Chrome/Chromium is installed via system package managers.
Root Cause:
_find_chromium_executable()only checked Windows paths, returningNoneon Linux/macOS.Solution: Extended browser detection to support system-installed Chrome/Chromium across all platforms, enabling users on non-Debian distributions to use their system browsers when Playwright browser installation is unavailable.
Type
Proposed Changes
_find_chromium_executable()to detect Chrome/Chromium on Linux and macOS/usr/bin/chromium,/usr/bin/google-chrome,/usr/bin/google-chrome-stable)/snap/bin/chromium)Screenshots / Code Snippets (if applicable)
Before:

After:
How to Test
On non-Debian Linux (OpenSUSE, Fedora, Arch):
npm run dev:backendOn Debian/Ubuntu (regression test):
On Windows (regression test):
Checklist
Additional Information
Tested Environment:
zypperImpact:
Technical Notes:
Summary by cubic
Fixes PDF generation on non-Debian Linux by detecting system-installed Chrome/Chromium when Playwright isn’t available. Adds macOS support and keeps Windows behavior unchanged.
Written for commit 4aee8cb. Summary will update on new commits.